<template>
	<view class="">
		<view class="content">
			<view class="title">请为我们提供您宝贵的建议～</view>
			<textarea v-model="data.form.complaintText" class="yijian" placeholder-class="psc" name="" id="" cols="30"
				rows="10" placeholder="请输入您宝贵的建议～"></textarea>
		</view>
		<view class="btn-b">
			<view class="blue-btn" @click="save">提交</view>
		</view>
	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue';
	import {
		onLoad
	} from '@dcloudio/uni-app';
	import {
		saveComplaint
	} from '../../requestApi/api.js';
	const data = ref({
		form: {
			complaintText: '',
			userId: ''
		}

	});
	onLoad(() => {
		data.value.form.userId = uni.getStorageSync('userInfo').id;
	})
	const save = () => {
		if (data.value.form.complaintText) {
			saveComplaint(data.value.form).then(res => {
				uni.showToast({
					title: '提交成功'
				})
			})
		} else {
			uni.showToast({
				icon: 'none',
				title: '请填写建议'
			})
		}


	};
</script>

<style lang="scss">
	.content {
		padding: 36rpx 40rpx;

		.title {
			font-size: 36rpx;
			font-weight: bold;
			color: #2C2C2C;
			margin-bottom: 28rpx;
		}

		.yijian {
			border: 2rpx solid #F5F5F5;
			padding: 20rpx 20rpx;
			border-radius: 6rpx;
			font-size: 28rpx;
		}

	}


	.psc {
		font-size: 28rpx;
		color: #CCCCCC;
	}
</style>